SELECT *
FROM BPS_Patients
WHERE StatusText = 'Active'
AND Internalid IN(
    SELECT INTERNALID
    FROM INVOICES i
    WHERE RECORDSTATUS = 1
    AND INVOICEID IN(
        SELECT INVOICEID
        FROM SERVICES s
        WHERE s.MBSITEM IN (721, 723, 732, 92024, 92025, 92028, 229, 230, 233, 92055, 92056, 92059, 965, 967, 92029, 92030, 392, 393, 92060, 92061)
        AND s.SERVICESTATUS in (0,2)
        AND s.RECORDSTATUS=1
        AND s.SERVICEDATE >= '20140101'
        AND s.SERVICEDATE <= '20141231' -- Set these to your desired date range, format is YYYYMMDD.
))
ORDER BY surname,firstname;

-- Active Patients invoiced for Care Plans between specified dates